//
//  CHTableViewCell.m
//  SZTZ
//
//  Created by 陈浩 on 2017/3/7.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHTableViewCell.h"

@implementation CHTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}



+(instancetype)cellForTableView:(UITableView *)tableView andWidth:(CGFloat)width{
    
    static NSString *ID = @"cell";
    
    CHTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[CHTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID withWidth:width];
        
    }
    return cell;
    
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withWidth:(CGFloat)width{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
   
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(8, 0, width, self.bounds.size.height)];
        label.font = [UIFont systemFontOfSize:14];
        label.textAlignment = NSTextAlignmentLeft;
        label.numberOfLines = 0;
        [self.contentView addSubview:label];
        self.textView = label;
        
    }
    return self;
}





//-(void)setWidth:(CGFloat)width{
//    
//    _width = width;
//    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, self.bounds.size.height)];
//    label.font = [UIFont systemFontOfSize:14];
//    label.textAlignment = NSTextAlignmentCenter;
//    label.numberOfLines = 0;
//    [self.contentView addSubview:label];
//    self.textView = label;
//}
//


@end
